package com.ruoyi.system.config;

import java.util.Random;

public class RandomUtil {

    private static final String CHARACTERS = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
    private static final int CODE_LENGTH = 16;
    private static final int MAC_LENGTH = 8;
    private static final Random RANDOM = new Random();

    public static String generateRandomCode() {
        StringBuilder code = new StringBuilder(CODE_LENGTH);
        for (int i = 0; i < CODE_LENGTH; i++) {
            code.append(CHARACTERS.charAt(RANDOM.nextInt(CHARACTERS.length())));
        }
        return code.toString();
    }

    public static String generateRandMacId() {
        StringBuilder code = new StringBuilder(MAC_LENGTH);
        for (int i = 0; i < MAC_LENGTH; i++) {
            code.append(CHARACTERS.charAt(RANDOM.nextInt(CHARACTERS.length())));
        }
        return code.toString();
    }
}